<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8" />
    
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
  <title>
     Yolin
  </title>
  <meta name="generator" content="hexo-theme-yilia-plus">
  
  <link rel="shortcut icon" href="/favicon.png" />
  
  
<link rel="stylesheet" href="/css/style.css">

  
<script src="/js/pace.min.js"></script>


  

  

<link rel="alternate" href="/atom.xml" title="Yolin" type="application/atom+xml">
</head>

</html>

<body>
  <div id="app">
    <main class="content">
      
<section class="cover">
    
  <div class="cover-frame">
    <div class="bg-box">
      <img src="/images/cover2.jpg" alt="image frame" />
    </div>
    <div class="cover-inner text-center text-white">
      <h1><a href="/">Yolin</a></h1>
      <div id="subtitle-box">
        
        <span id="subtitle"></span>
        
      </div>
      <div>
        
      </div>
    </div>
  </div>
  <div class="cover-learn-more">
    <a href="javascript:void(0)" class="anchor"><i class="ri-arrow-down-line"></i></a>
  </div>
</section>



<script src="https://cdn.jsdelivr.net/npm/typed.js@2.0.11/lib/typed.min.js"></script>

<div id="main">
  <section class="outer">
  <article class="articles">
    
    
    
    
    <article id="post-jdbc详解" class="article article-type-post" itemscope
  itemprop="blogPost" data-scroll-reveal>

  <div class="article-inner">
    
    <header class="article-header">
       
<h2 itemprop="name">
  <a class="article-title" href="/2020/09/13/jdbc%E8%AF%A6%E8%A7%A3/"
    >jdbc详解</a
  >
</h2>
  

    </header>
    

    
    <div class="article-meta">
      <a href="/2020/09/13/jdbc%E8%AF%A6%E8%A7%A3/" class="article-date">
  <time datetime="2020-09-13T14:45:02.000Z" itemprop="datePublished">2020-09-13</time>
</a>
      
  <div class="article-category">
    <a class="article-category-link" href="/categories/Java-Web/">Java Web</a>
  </div>

      
      
      
    </div>
    

    

    <div class="article-entry" itemprop="articleBody">
      


      

      
      <h1 id="jdbc概念"><a href="#jdbc概念" class="headerlink" title="jdbc概念"></a>jdbc概念</h1><p><strong>jdbc</strong>（Java Database Connectivity），是一种用于执行SQL语句的Java API，也就是java操作数据库，其本质是官方定义的一套操作所有关系型数据库的接口。</p>
<p>常见的关系数据库有<a href="https://baike.baidu.com/item/%E5%85%B3%E7%B3%BB%E5%9E%8B%E6%95%B0%E6%8D%AE%E5%BA%93/8999831?fr=aladdin" target="_blank" rel="noopener">Oracle、DB2、Microsoft SQL Server、Microsoft Access、MySQL</a>等，而jdbc就是为这些关系型数据库提供统一访问，数据库厂商自己写的实现类，封装成数据库驱动jar包。</p>
<p>真正执行的代码是驱动jar包中的实现类，如下形式使用</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//Person接口、Worker类</span></span><br><span class="line"><span class="comment">//父类引用指向子类对象</span></span><br><span class="line"> Person p=<span class="keyword">new</span> Worker();</span><br><span class="line"> <span class="comment">//多态调用</span></span><br><span class="line"> p.eat();</span><br></pre></td></tr></table></figure>

<h1 id="jdbc快速入门"><a href="#jdbc快速入门" class="headerlink" title="jdbc快速入门"></a>jdbc快速入门</h1><p><a href="https://yolin121.gitee.io/2020/05/19/Java%E8%BF%9E%E6%8E%A5mysql-jdbc/" target="_blank" rel="noopener">jdbc快速入门</a></p>
<h3 id="步骤："><a href="#步骤：" class="headerlink" title="步骤："></a>步骤：</h3><ol>
<li>导入驱动jar包</li>
<li>注册驱动</li>
<li>获取数据库连接对象 Connection</li>
<li>定义sql</li>
<li>获取执行sql语句的对象 Statement</li>
<li>执行sql，接收返回的结果</li>
<li>处理结果</li>
<li>释放资源</li>
</ol>
      
      <a class="article-more-link" href="/2020/09/13/jdbc%E8%AF%A6%E8%A7%A3/">阅读更多...</a>
      
      
      <!-- reward -->
      
    </div>
      <!-- copyright -->
      
    <footer class="article-footer">
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/jdbc/" rel="tag">jdbc</a></li></ul>


    </footer>

  </div>

  

  
  
  

  

</article>
    
    <article id="post-SQL从删库到跑路-二" class="article article-type-post" itemscope
  itemprop="blogPost" data-scroll-reveal>

  <div class="article-inner">
    
    <header class="article-header">
       
<h2 itemprop="name">
  <a class="article-title" href="/2020/09/09/SQL%E4%BB%8E%E5%88%A0%E5%BA%93%E5%88%B0%E8%B7%91%E8%B7%AF-%E4%BA%8C/"
    >SQL从删库到跑路(二)</a
  >
</h2>
  

    </header>
    

    
    <div class="article-meta">
      <a href="/2020/09/09/SQL%E4%BB%8E%E5%88%A0%E5%BA%93%E5%88%B0%E8%B7%91%E8%B7%AF-%E4%BA%8C/" class="article-date">
  <time datetime="2020-09-09T04:45:02.000Z" itemprop="datePublished">2020-09-09</time>
</a>
      
  <div class="article-category">
    <a class="article-category-link" href="/categories/SQL/">SQL</a>
  </div>

      
      
      
    </div>
    

    

    <div class="article-entry" itemprop="articleBody">
      


      

      
      <h1 id="一、DML：增删改表中数据"><a href="#一、DML：增删改表中数据" class="headerlink" title="一、DML：增删改表中数据"></a>一、DML：增删改表中数据</h1><h3 id="1-添加数据"><a href="#1-添加数据" class="headerlink" title="1. 添加数据"></a>1. 添加数据</h3><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">-- 常规写法</span></span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> stu(<span class="keyword">sid</span>,sname,sage) <span class="keyword">values</span>(<span class="number">172922</span>,<span class="string">'朱同心'</span>,<span class="number">22</span>);</span><br><span class="line"><span class="comment">-- 简便写法</span></span><br><span class="line"><span class="keyword">insert</span> <span class="keyword">into</span> stu <span class="keyword">values</span>(<span class="number">17200</span>,<span class="string">'刘升升'</span>,<span class="number">21</span>,<span class="literal">null</span>,<span class="literal">null</span>);</span><br></pre></td></tr></table></figure>

<h3 id="2-删除数据"><a href="#2-删除数据" class="headerlink" title="2. 删除数据"></a>2. 删除数据</h3><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"> <span class="keyword">delete</span> <span class="keyword">from</span> 表名 whrere 条件;</span><br><span class="line"><span class="comment">-- 注意：如果不加条件则删除表中所有记录</span></span><br><span class="line"> </span><br><span class="line"><span class="comment">-- 删除表，然后再创建一个一模一样的空表(效率高)</span></span><br><span class="line"> <span class="keyword">truncate</span> <span class="keyword">table</span> stu;</span><br></pre></td></tr></table></figure>

<h3 id="3-修改数据"><a href="#3-修改数据" class="headerlink" title="3. 修改数据"></a>3. 修改数据</h3><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"> <span class="keyword">update</span> 表名 <span class="keyword">set</span> 列名<span class="number">1</span>=值<span class="number">1</span>，列名<span class="number">2</span>=值<span class="number">2</span> <span class="keyword">where</span> 条件</span><br><span class="line"> </span><br><span class="line"><span class="comment">-- 将朱同心的名字改为猪大头，年龄改为24</span></span><br><span class="line"> <span class="keyword">update</span> stu <span class="keyword">set</span> sname=<span class="string">'猪大头'</span>,sage=<span class="number">24</span> <span class="keyword">where</span> sname=<span class="string">'朱同心'</span>;</span><br><span class="line"> </span><br><span class="line"><span class="comment">-- 注意：如果不加条件则会将表中所有记录全部修改</span></span><br></pre></td></tr></table></figure>
      
      <a class="article-more-link" href="/2020/09/09/SQL%E4%BB%8E%E5%88%A0%E5%BA%93%E5%88%B0%E8%B7%91%E8%B7%AF-%E4%BA%8C/">阅读更多...</a>
      
      
      <!-- reward -->
      
    </div>
      <!-- copyright -->
      
    <footer class="article-footer">
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/DML/" rel="tag">DML</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/DQL/" rel="tag">DQL</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/SQL/" rel="tag">SQL</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/%E7%BA%A7%E8%81%94%E6%93%8D%E4%BD%9C/" rel="tag">级联操作</a></li></ul>


    </footer>

  </div>

  

  
  
  

  

</article>
    
    <article id="post-SQL从删库到跑路-一" class="article article-type-post" itemscope
  itemprop="blogPost" data-scroll-reveal>

  <div class="article-inner">
    
    <header class="article-header">
       
<h2 itemprop="name">
  <a class="article-title" href="/2020/09/06/SQL%E4%BB%8E%E5%88%A0%E5%BA%93%E5%88%B0%E8%B7%91%E8%B7%AF-%E4%B8%80/"
    >SQL从删库到跑路(一)</a
  >
</h2>
  

    </header>
    

    
    <div class="article-meta">
      <a href="/2020/09/06/SQL%E4%BB%8E%E5%88%A0%E5%BA%93%E5%88%B0%E8%B7%91%E8%B7%AF-%E4%B8%80/" class="article-date">
  <time datetime="2020-09-06T13:45:02.000Z" itemprop="datePublished">2020-09-06</time>
</a>
      
  <div class="article-category">
    <a class="article-category-link" href="/categories/SQL/">SQL</a>
  </div>

      
      
      
    </div>
    

    

    <div class="article-entry" itemprop="articleBody">
      


      

      
      <h1 id="一、什么是SQL？"><a href="#一、什么是SQL？" class="headerlink" title="一、什么是SQL？"></a>一、什么是SQL？</h1><blockquote>
<p><strong>SQL</strong>(Structured Query Language)<strong>结构化查询语言</strong></p>
</blockquote>
<blockquote>
<p>即定义了操作所有关系型数据库的规则。</p>
</blockquote>
<h1 id="二、SQL通用语法"><a href="#二、SQL通用语法" class="headerlink" title="二、SQL通用语法"></a>二、SQL通用语法</h1><ol>
<li>SQL语句可以单行或多行书写，以分号结尾</li>
<li>不区分大小写</li>
<li>注释</li>
</ol>
<ul>
<li><blockquote>
<p>单行注释：– 内容 或 # 内容</p>
</blockquote>
</li>
<li><blockquote>
<p>多行注释： /* 注释 */</p>
</blockquote>
</li>
</ul>
<h1 id="三、SQL分类"><a href="#三、SQL分类" class="headerlink" title="三、SQL分类"></a>三、SQL分类</h1><h2 id="1-DDL"><a href="#1-DDL" class="headerlink" title="1. DDL"></a>1. <strong>DDL</strong></h2><p> (Data Definition Language) <strong>数据定义语言</strong></p>
<ul>
<li><blockquote>
<p> 用来定义数据库对象：数据库，表，列等。关键字：Create,drop,alter等</p>
</blockquote>
</li>
</ul>
<h2 id="2-DML"><a href="#2-DML" class="headerlink" title="2. DML"></a>2. <strong>DML</strong></h2><p> (Data Manipulation Language)<strong>数据操作语言</strong></p>
<ul>
<li><blockquote>
<p>用来对数据库中的表数据进行增删改。关键字：insert，delete，update等</p>
</blockquote>
</li>
</ul>
      
      <a class="article-more-link" href="/2020/09/06/SQL%E4%BB%8E%E5%88%A0%E5%BA%93%E5%88%B0%E8%B7%91%E8%B7%AF-%E4%B8%80/">阅读更多...</a>
      
      
      <!-- reward -->
      
    </div>
      <!-- copyright -->
      
    <footer class="article-footer">
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/DDL/" rel="tag">DDL</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/SQL/" rel="tag">SQL</a></li></ul>


    </footer>

  </div>

  

  
  
  

  

</article>
    
    <article id="post-JavaEE-JavaEE-Junit测试、反射与注解的使用" class="article article-type-post" itemscope
  itemprop="blogPost" data-scroll-reveal>

  <div class="article-inner">
    
    <header class="article-header">
       
<h2 itemprop="name">
  <a class="article-title" href="/2020/09/06/JavaEE-JavaEE-Junit%E6%B5%8B%E8%AF%95%E3%80%81%E5%8F%8D%E5%B0%84%E4%B8%8E%E6%B3%A8%E8%A7%A3%E7%9A%84%E4%BD%BF%E7%94%A8/"
    >JavaEE-Junit测试、反射与注解的使用</a
  >
</h2>
  

    </header>
    

    
    <div class="article-meta">
      <a href="/2020/09/06/JavaEE-JavaEE-Junit%E6%B5%8B%E8%AF%95%E3%80%81%E5%8F%8D%E5%B0%84%E4%B8%8E%E6%B3%A8%E8%A7%A3%E7%9A%84%E4%BD%BF%E7%94%A8/" class="article-date">
  <time datetime="2020-09-06T07:58:02.000Z" itemprop="datePublished">2020-09-06</time>
</a>
      
  <div class="article-category">
    <a class="article-category-link" href="/categories/Java/">Java</a>
  </div>

      
      
      
    </div>
    

    

    <div class="article-entry" itemprop="articleBody">
      


      

      
      <h1 id="一、Junit单元测试"><a href="#一、Junit单元测试" class="headerlink" title="一、Junit单元测试"></a>一、Junit单元测试</h1><h2 id="测试分类"><a href="#测试分类" class="headerlink" title="测试分类"></a>测试分类</h2><ol>
<li><p><strong>黑盒测试</strong>：不需要写代码，给输入值，看程序是否能够输出期望的值</p>
</li>
<li><p><strong>白盒测试</strong>：需要写代码。关注程序具体的执行流程，Junit就属于其中的一种。</p>
</li>
</ol>
<h2 id="Junit使用"><a href="#Junit使用" class="headerlink" title="Junit使用"></a>Junit使用</h2><ol>
<li>定义一个测试类（测试用例）</li>
<li>定义测试方法：可以独立运行<blockquote>
<p>返回值用void;方法名为test测试的方法名，如 testAdd() ;参数列表为空</p>
</blockquote>
</li>
<li>给方法加@Test</li>
<li>导入junit依赖环境</li>
</ol>
<p><img src="https://yolin121.oss-cn-beijing.aliyuncs.com/blogimg/Snipaste_2020-09-05_17-12-22.jpg" alt=""></p>
      
      <a class="article-more-link" href="/2020/09/06/JavaEE-JavaEE-Junit%E6%B5%8B%E8%AF%95%E3%80%81%E5%8F%8D%E5%B0%84%E4%B8%8E%E6%B3%A8%E8%A7%A3%E7%9A%84%E4%BD%BF%E7%94%A8/">阅读更多...</a>
      
      
      <!-- reward -->
      
    </div>
      <!-- copyright -->
      
    <footer class="article-footer">
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Junit%E6%B5%8B%E8%AF%95/" rel="tag">Junit测试</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/%E5%8F%8D%E5%B0%84/" rel="tag">反射</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/%E6%B3%A8%E8%A7%A3/" rel="tag">注解</a></li></ul>


    </footer>

  </div>

  

  
  
  

  

</article>
    
    <article id="post-Java-类加载器与反射" class="article article-type-post" itemscope
  itemprop="blogPost" data-scroll-reveal>

  <div class="article-inner">
    
    <header class="article-header">
       
<h2 itemprop="name">
  <a class="article-title" href="/2020/09/05/Java-%E7%B1%BB%E5%8A%A0%E8%BD%BD%E5%99%A8%E4%B8%8E%E5%8F%8D%E5%B0%84/"
    >Java-类加载器与反射</a
  >
</h2>
  

    </header>
    

    
    <div class="article-meta">
      <a href="/2020/09/05/Java-%E7%B1%BB%E5%8A%A0%E8%BD%BD%E5%99%A8%E4%B8%8E%E5%8F%8D%E5%B0%84/" class="article-date">
  <time datetime="2020-09-05T03:58:02.000Z" itemprop="datePublished">2020-09-05</time>
</a>
      
  <div class="article-category">
    <a class="article-category-link" href="/categories/Java/">Java</a>
  </div>

      
      
      
    </div>
    

    

    <div class="article-entry" itemprop="articleBody">
      


      

      
      <h1 id="一、类加载器"><a href="#一、类加载器" class="headerlink" title="一、类加载器"></a>一、类加载器</h1><h2 id="1-1-类加载"><a href="#1-1-类加载" class="headerlink" title="1.1 类加载"></a>1.1 类加载</h2><p>当程序要使用某个类时，如果该类还未被加载到内存中，则系统会通过<strong>类的加载，类的连接，类的初始化</strong>这三个步骤来对类进行初始化。如果不出现意外情况，JVM将会连续完成这三个步骤，所以有时也把这三个步骤统称为<strong>类的加载或者类初始化</strong></p>
<h3 id="①类的加载"><a href="#①类的加载" class="headerlink" title="①类的加载"></a>①类的加载</h3><ul>
<li>就是指将class文件读入内存，并为之创建一个java.lang.Class对象</li>
<li>任何类被使用时，系统都会为之建立一个java.lang.Class对象</li>
</ul>
<h3 id="②类的连接"><a href="#②类的连接" class="headerlink" title="②类的连接"></a>②类的连接</h3><ul>
<li><strong>验证阶段</strong>：用于检验被加载的类是否有正确的内部结构，并和其他类协调一致</li>
<li><strong>准备阶段</strong>：负责为类变量分配内存，并设置默认初始化值</li>
<li><strong>解析阶段</strong>：将类的二进制数据中的符号引用替换为直接引用</li>
</ul>
<h3 id="③类的初始化"><a href="#③类的初始化" class="headerlink" title="③类的初始化"></a>③类的初始化</h3><ul>
<li>在该阶段，主要就是对类变量进行初始化</li>
</ul>
<h5 id="类的初始化步骤："><a href="#类的初始化步骤：" class="headerlink" title="类的初始化步骤："></a>类的初始化步骤：</h5>
      
      <a class="article-more-link" href="/2020/09/05/Java-%E7%B1%BB%E5%8A%A0%E8%BD%BD%E5%99%A8%E4%B8%8E%E5%8F%8D%E5%B0%84/">阅读更多...</a>
      
      
      <!-- reward -->
      
    </div>
      <!-- copyright -->
      
    <footer class="article-footer">
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/%E5%8F%8D%E5%B0%84/" rel="tag">反射</a></li></ul>


    </footer>

  </div>

  

  
  
  

  

</article>
    
    <article id="post-Java-Stream流" class="article article-type-post" itemscope
  itemprop="blogPost" data-scroll-reveal>

  <div class="article-inner">
    
    <header class="article-header">
       
<h2 itemprop="name">
  <a class="article-title" href="/2020/08/30/Java-Stream%E6%B5%81/"
    >Java-Stream流</a
  >
</h2>
  

    </header>
    

    
    <div class="article-meta">
      <a href="/2020/08/30/Java-Stream%E6%B5%81/" class="article-date">
  <time datetime="2020-08-30T09:58:02.000Z" itemprop="datePublished">2020-08-30</time>
</a>
      
  <div class="article-category">
    <a class="article-category-link" href="/categories/Java/">Java</a>
  </div>

      
      
      
    </div>
    

    

    <div class="article-entry" itemprop="articleBody">
      


      

      
      <h2 id="一、体验Stream流"><a href="#一、体验Stream流" class="headerlink" title="一、体验Stream流"></a>一、体验Stream流</h2><p>需求：</p>
<ol>
<li>创建一个集合，存储多个字符串元素</li>
<li>把集合中所有以“张”开头的元素存储到一个新的集合</li>
<li>把“张”开头的集合中的长度为3的元素存储到新的集合</li>
<li>遍历上一步得到的集合</li>
</ol>
<p><img src="https://yolin121.oss-cn-beijing.aliyuncs.com/blogimg/Snipaste_2020-08-29_10-10-35.jpg" alt=""></p>
<p>而这样内容太复杂了，想使代码更简洁就需要用到接下来要学习的Stream流</p>
      
      <a class="article-more-link" href="/2020/08/30/Java-Stream%E6%B5%81/">阅读更多...</a>
      
      
      <!-- reward -->
      
    </div>
      <!-- copyright -->
      
    <footer class="article-footer">
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Stream%E6%B5%81/" rel="tag">Stream流</a></li></ul>


    </footer>

  </div>

  

  
  
  

  

</article>
    
    <article id="post-Java-函数式接口" class="article article-type-post" itemscope
  itemprop="blogPost" data-scroll-reveal>

  <div class="article-inner">
    
    <header class="article-header">
       
<h2 itemprop="name">
  <a class="article-title" href="/2020/08/28/Java-%E5%87%BD%E6%95%B0%E5%BC%8F%E6%8E%A5%E5%8F%A3/"
    >Java-函数式接口</a
  >
</h2>
  

    </header>
    

    
    <div class="article-meta">
      <a href="/2020/08/28/Java-%E5%87%BD%E6%95%B0%E5%BC%8F%E6%8E%A5%E5%8F%A3/" class="article-date">
  <time datetime="2020-08-28T09:58:02.000Z" itemprop="datePublished">2020-08-28</time>
</a>
      
  <div class="article-category">
    <a class="article-category-link" href="/categories/Java/">Java</a>
  </div>

      
      
      
    </div>
    

    

    <div class="article-entry" itemprop="articleBody">
      


      

      
      <h2 id="1-1-函数式接口概述"><a href="#1-1-函数式接口概述" class="headerlink" title="1.1 函数式接口概述"></a>1.1 函数式接口概述</h2><p><strong>函数式接口：有且仅有一个抽象方法的接口</strong></p>
<p>Java中的函数式编程体现就是Lambda表达式，所以函数式接口就是可以适用于Lambda使用的接口，只有确保接口中有且仅有一个抽象方法，Java中的Lambda才能顺利进行推导</p>
<p><img src="https://yolin121.oss-cn-beijing.aliyuncs.com/blogimg/Snipaste_2020-08-27_10-56-58.jpg" alt=""></p>
<p>检测一个接口是否为函数式接口用 <strong>@FunctionalInterface</strong>，放在接口定义上方如果是编译通过，反之。</p>
      
      <a class="article-more-link" href="/2020/08/28/Java-%E5%87%BD%E6%95%B0%E5%BC%8F%E6%8E%A5%E5%8F%A3/">阅读更多...</a>
      
      
      <!-- reward -->
      
    </div>
      <!-- copyright -->
      
    <footer class="article-footer">
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/%E5%87%BD%E6%95%B0%E5%BC%8F%E6%8E%A5%E5%8F%A3/" rel="tag">函数式接口</a></li></ul>


    </footer>

  </div>

  

  
  
  

  

</article>
    
    <article id="post-Java-方法引用" class="article article-type-post" itemscope
  itemprop="blogPost" data-scroll-reveal>

  <div class="article-inner">
    
    <header class="article-header">
       
<h2 itemprop="name">
  <a class="article-title" href="/2020/08/25/Java-%E6%96%B9%E6%B3%95%E5%BC%95%E7%94%A8/"
    >Java-方法引用</a
  >
</h2>
  

    </header>
    

    
    <div class="article-meta">
      <a href="/2020/08/25/Java-%E6%96%B9%E6%B3%95%E5%BC%95%E7%94%A8/" class="article-date">
  <time datetime="2020-08-25T12:58:02.000Z" itemprop="datePublished">2020-08-25</time>
</a>
      
  <div class="article-category">
    <a class="article-category-link" href="/categories/Java/">Java</a>
  </div>

      
      
      
    </div>
    

    

    <div class="article-entry" itemprop="articleBody">
      


      

      
      <h2 id="一、初见方法引用"><a href="#一、初见方法引用" class="headerlink" title="一、初见方法引用"></a>一、初见方法引用</h2><p>考虑一种情况：如果我们在Lambda中所指定的操作方案，已经有地方存在相同方案，那么是否还有必要再写重复逻辑呢？</p>
<p>答案是没有必要</p>
<p>所以要是用<strong>方法引用</strong>来使用已经存在的方案<br><img src="https://yolin121.oss-cn-beijing.aliyuncs.com/blogimg/Snipaste_2020-08-25_10-31-27.jpg" alt=""></p>
<h2 id="二、方法引用符"><a href="#二、方法引用符" class="headerlink" title="二、方法引用符"></a>二、方法引用符</h2>
      
      <a class="article-more-link" href="/2020/08/25/Java-%E6%96%B9%E6%B3%95%E5%BC%95%E7%94%A8/">阅读更多...</a>
      
      
      <!-- reward -->
      
    </div>
      <!-- copyright -->
      
    <footer class="article-footer">
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/%E6%96%B9%E6%B3%95%E5%BC%95%E7%94%A8/" rel="tag">方法引用</a></li></ul>


    </footer>

  </div>

  

  
  
  

  

</article>
    
    <article id="post-Java-接口组成更新" class="article article-type-post" itemscope
  itemprop="blogPost" data-scroll-reveal>

  <div class="article-inner">
    
    <header class="article-header">
       
<h2 itemprop="name">
  <a class="article-title" href="/2020/08/24/Java-%E6%8E%A5%E5%8F%A3%E7%BB%84%E6%88%90%E6%9B%B4%E6%96%B0/"
    >Java-接口组成更新</a
  >
</h2>
  

    </header>
    

    
    <div class="article-meta">
      <a href="/2020/08/24/Java-%E6%8E%A5%E5%8F%A3%E7%BB%84%E6%88%90%E6%9B%B4%E6%96%B0/" class="article-date">
  <time datetime="2020-08-24T14:58:02.000Z" itemprop="datePublished">2020-08-24</time>
</a>
      
  <div class="article-category">
    <a class="article-category-link" href="/categories/Java/">Java</a>
  </div>

      
      
      
    </div>
    

    

    <div class="article-entry" itemprop="articleBody">
      


      

      
      <h2 id="一、接口组成"><a href="#一、接口组成" class="headerlink" title="一、接口组成"></a>一、接口组成</h2><ul>
<li><strong>常量</strong> public static final</li>
<li><strong>抽象方法</strong> public abstract</li>
<li><strong>默认方法</strong>（Java8）</li>
<li><strong>静态方法</strong>（Java8）</li>
<li><strong>私有方法</strong>（Java9）</li>
</ul>
<h3 id="案例"><a href="#案例" class="headerlink" title="案例"></a>案例</h3><p>需求：</p>
<ol>
<li>定义一个接口Myinterface,里面有两个抽象方法：</li>
</ol>
<blockquote>
<p>   void show1();</p>
<p>   void show2();</p>
</blockquote>
<ol start="2">
<li>定义接口的两个实现类：</li>
</ol>
<blockquote>
<p>InterIml1</p>
<p>InterIml2</p>
</blockquote>
      
      <a class="article-more-link" href="/2020/08/24/Java-%E6%8E%A5%E5%8F%A3%E7%BB%84%E6%88%90%E6%9B%B4%E6%96%B0/">阅读更多...</a>
      
      
      <!-- reward -->
      
    </div>
      <!-- copyright -->
      
    <footer class="article-footer">
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/%E6%8E%A5%E5%8F%A3/" rel="tag">接口</a></li></ul>


    </footer>

  </div>

  

  
  
  

  

</article>
    
    <article id="post-Lambda表达式" class="article article-type-post" itemscope
  itemprop="blogPost" data-scroll-reveal>

  <div class="article-inner">
    
    <header class="article-header">
       
<h2 itemprop="name">
  <a class="article-title" href="/2020/08/24/Lambda%E8%A1%A8%E8%BE%BE%E5%BC%8F/"
    >Lambda表达式</a
  >
</h2>
  

    </header>
    

    
    <div class="article-meta">
      <a href="/2020/08/24/Lambda%E8%A1%A8%E8%BE%BE%E5%BC%8F/" class="article-date">
  <time datetime="2020-08-24T07:58:02.000Z" itemprop="datePublished">2020-08-24</time>
</a>
      
  <div class="article-category">
    <a class="article-category-link" href="/categories/Java/">Java</a>
  </div>

      
      
      
    </div>
    

    

    <div class="article-entry" itemprop="articleBody">
      


      

      
      <h1 id="体验Lambda表达式"><a href="#体验Lambda表达式" class="headerlink" title="体验Lambda表达式"></a>体验Lambda表达式</h1><p>需求：启动一个线程，在控制台输出：多线程程序启动了</p>
<h2 id="方式一、实现类的方式"><a href="#方式一、实现类的方式" class="headerlink" title="方式一、实现类的方式"></a>方式一、实现类的方式</h2><ul>
<li>定义一个类MyRunnable实现Runnable接口，重写run()方法</li>
<li>创建MyRunnable类的对象</li>
<li>创建Thread类的对象，把MyRunnable的对象作为构造参数传递</li>
<li>启动线程</li>
</ul>
<p><img src="https://yolin121.oss-cn-beijing.aliyuncs.com/blogimg/Snipaste_2020-08-22_20-28-03.jpg" alt=""></p>
      
      <a class="article-more-link" href="/2020/08/24/Lambda%E8%A1%A8%E8%BE%BE%E5%BC%8F/">阅读更多...</a>
      
      
      <!-- reward -->
      
    </div>
      <!-- copyright -->
      
    <footer class="article-footer">
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Lambda/" rel="tag">Lambda</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/%E5%8C%BF%E5%90%8D%E5%86%85%E9%83%A8%E7%B1%BB/" rel="tag">匿名内部类</a></li></ul>


    </footer>

  </div>

  

  
  
  

  

</article>
    
  </article>
  

  
  <nav class="page-nav">
    
    <a class="extend prev" rel="prev" href="/page/3/">上一页</a><a class="page-number" href="/">1</a><a class="page-number" href="/page/2/">2</a><a class="page-number" href="/page/3/">3</a><span class="page-number current">4</span><a class="page-number" href="/page/5/">5</a><a class="page-number" href="/page/6/">6</a><span class="space">&hellip;</span><a class="page-number" href="/page/10/">10</a><a class="extend next" rel="next" href="/page/5/">下一页</a>
  </nav>
  
</section>
</div>

      <footer class="footer">
  <div class="outer">
    <ul class="list-inline">
      <li>
        &copy;
        2020-2021
        张金
      </li>
      <li>
        
      </li>
    </ul>
    <ul class="list-inline">
      <li>
        
        
        <span>
  <i>PV:<span id="busuanzi_value_page_pv"></span></i>
  <i>UV:<span id="busuanzi_value_site_uv"></span></i>
</span>
        
      </li>
      <li>
        <!-- cnzz统计 -->
        
        <script type="text/javascript" src='https://s9.cnzz.com/z_stat.php?id=1278069914&amp;web_id=1278069914'></script>
        
        <img src="https://yolin121.oss-cn-beijing.aliyuncs.com/blogimg/beian.png">
        <a href="https://beian.miit.gov.cn"  style="color:#f72b07" target="_blank">陕ICP备20002449号</a>
      </li>

    </ul>
  </div>
</footer>
    <div class="to_top">
        <div class="totop" id="totop">
  <i class="ri-arrow-up-line"></i>
</div>
      </div>
    </main>
      <aside class="sidebar">
        <button class="navbar-toggle"></button>
<nav class="navbar">
  
  <div class="logo">
    <a href="/"><img src="/images/ayer-side.svg" alt="Yolin"></a>
  </div>
  
  <ul class="nav nav-main">
    
    <li class="nav-item">
      <a class="nav-item-link" href="/">主页</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/archives">归档</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/categories">分类</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags">标签</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/playlist">歌单</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/video">视频</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/about">关于我</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/friends">友情链接</a>
    </li>
    
  </ul>
</nav>
<nav class="navbar navbar-bottom">
  <ul class="nav">
    <li class="nav-item">
      
      <a class="nav-item-link nav-item-search"  title="Search">
        <i class="ri-search-line"></i>
      </a>
      
      
      <a class="nav-item-link" target="_blank" href="/atom.xml" title="RSS Feed">
        <i class="ri-rss-line"></i>
      </a>
      
    </li>
  </ul>
</nav>
<div class="search-form-wrap">
  <div class="local-search local-search-plugin">
  <input type="search" id="local-search-input" class="local-search-input" placeholder="Search...">
  <div id="local-search-result" class="local-search-result"></div>
</div>
</div>
      </aside>
      <div id="mask"></div>

<!-- #reward -->
<div id="reward">
  <span class="close"><i class="ri-close-line"></i></span>
  <p class="reward-p"><i class="ri-cup-line"></i>请我喝杯咖啡吧~</p>
  <div class="reward-box">
    
    <div class="reward-item">
      <img class="reward-img" src="/images/alipay.jpg">
      <span class="reward-type">支付宝</span>
    </div>
    
    
    <div class="reward-item">
      <img class="reward-img" src="/images/wechat.jpg">
      <span class="reward-type">微信</span>
    </div>
    
  </div>
</div>
      
<script src="/js/jquery-2.0.3.min.js"></script>


<script src="/js/jquery.justifiedGallery.min.js"></script>


<script src="/js/lazyload.min.js"></script>


<script src="/js/busuanzi-2.3.pure.min.js"></script>


<script src="/js/share.js"></script>




<script>
  try {
    var typed = new Typed("#subtitle", {
    strings: ['肠断月明红豆蔻,','月似当时,','人似当时否？'],
    startDelay: 1500,
    typeSpeed: 200,
    loop: true,
    backSpeed: 40,
    showCursor: true
    });
  } catch (err) {
  }
  
</script>




<script>
  var ayerConfig = {
    mathjax: true
  }
</script>


<script src="/js/ayer.js"></script>


<script src="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.css">


<!-- Root element of PhotoSwipe. Must have class pswp. -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">

    <!-- Background of PhotoSwipe. 
         It's a separate element as animating opacity is faster than rgba(). -->
    <div class="pswp__bg"></div>

    <!-- Slides wrapper with overflow:hidden. -->
    <div class="pswp__scroll-wrap">

        <!-- Container that holds slides. 
            PhotoSwipe keeps only 3 of them in the DOM to save memory.
            Don't modify these 3 pswp__item elements, data is added later on. -->
        <div class="pswp__container">
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
        </div>

        <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
        <div class="pswp__ui pswp__ui--hidden">

            <div class="pswp__top-bar">

                <!--  Controls are self-explanatory. Order can be changed. -->

                <div class="pswp__counter"></div>

                <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>

                <button class="pswp__button pswp__button--share" style="display:none" title="Share"></button>

                <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>

                <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>

                <!-- Preloader demo http://codepen.io/dimsemenov/pen/yyBWoR -->
                <!-- element will get class pswp__preloader--active when preloader is running -->
                <div class="pswp__preloader">
                    <div class="pswp__preloader__icn">
                        <div class="pswp__preloader__cut">
                            <div class="pswp__preloader__donut"></div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
                <div class="pswp__share-tooltip"></div>
            </div>

            <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
            </button>

            <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
            </button>

            <div class="pswp__caption">
                <div class="pswp__caption__center"></div>
            </div>

        </div>

    </div>

</div>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/default-skin/default-skin.css">
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe-ui-default.min.js"></script>

<script>
    function viewer_init() {
        let pswpElement = document.querySelectorAll('.pswp')[0];
        let $imgArr = document.querySelectorAll(('.article-entry img:not(.reward-img)'))

        $imgArr.forEach(($em, i) => {
            $em.onclick = () => {
                // slider展开状态
                // todo: 这样不好，后面改成状态
                if (document.querySelector('.left-col.show')) return
                let items = []
                $imgArr.forEach(($em2, i2) => {
                    let img = $em2.getAttribute('data-idx', i2)
                    let src = $em2.getAttribute('data-target') || $em2.getAttribute('src')
                    let title = $em2.getAttribute('alt')
                    // 获得原图尺寸
                    const image = new Image()
                    image.src = src
                    items.push({
                        src: src,
                        w: image.width || $em2.width,
                        h: image.height || $em2.height,
                        title: title
                    })
                })
                var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, {
                    index: parseInt(i)
                });
                gallery.init()
            }
        })
    }
    viewer_init()
</script>



<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
      tex2jax: {
          inlineMath: [ ['$','$'], ["\\(","\\)"]  ],
          processEscapes: true,
          skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
      }
  });

  MathJax.Hub.Queue(function() {
      var all = MathJax.Hub.getAllJax(), i;
      for(i=0; i < all.length; i += 1) {
          all[i].SourceElement().parentNode.className += ' has-jax';
      }
  });
</script>

<script src="https://cdn.jsdelivr.net/npm/mathjax@2.7.6/unpacked/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>


<script type="text/javascript" src="https://js.users.51.la/20544303.js"></script>
  </div>
</body>

</html>